package com.hnevc.musicsystem;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;

public class MusicSystem {
	
	public ArrayList<Music> musicList;
	public void shiftTop(Music music){
		musicList.remove(music);
		musicList.add(0,music);
	}
	public void showMusics1(){
		musicList.get(0).play();
	}
	public void showMusics(){
		Iterator<Music> it = musicList.iterator();
		while(it.hasNext()){
			Music music = it.next();
			System.out.println(music.name+"\t"+music.singer);
		}
	}
	
	public void orderBySinger(){
		Collections.sort(musicList,new Comparator<Music>(){
			public int compare(Music o1,Music o2){
				return o1.singer.compareTo(o2.singer);
				
			}
		});
	}

}
